//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//    Crolengi, this program (a part of program) is gameengine based on C++\Directx
//    Copyright (C) 2008 Pashinin Anton Alekseevich (Crol)
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.
//    (INCLUDING NEGLIGENCE OR OTHERWISE) 
//    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 
//    EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
//    Contacts: 
//    Mail: crolengi@gmail.com
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


#include "Timer.h"
#include <windows.h>



void Timer::intialize()
{

}
unsigned int Timer::getCurrentTime(){
  stop = false;
  currentTime = timeGetTime();
  lastTime = currentTime;
  return currentTime;
}

void Timer::iStop(){
  if (stop==false){ 
   stop = true;
   lastTime = (timeGetTime() - lastTime);
  }
}
void Timer::iResume(){
	if (stop== true){
       stop = false;
	   int t;
	   t = lastTime;
       getCurrentTime();
       
	   lastTime-=t;
	   }
}

unsigned int Timer::getElapsedTimeMilliSeconds(){
	if(stop)
		return (lastTime);
	else
        return (timeGetTime() - lastTime);
}

unsigned int Timer::getElapsedTimeSeconds(){
	if(stop)
		return (lastTime);
	else
        return (timeGetTime() - lastTime)/1000;
}
